﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ZLDC.Common.Estate;

namespace ZLDC.Estate.TM
{
    public partial class EstateManager : _PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //加载用户信息,用户名称,部门名称,部门id
                iUserName.Value=this.info.m_sUserName;
                iUserDept.Value = this.info.m_sDeptName;
                ideptid.Value = this.info.m_sDeptID;
                
                LoadCity1();
                LoadCity2();
                LoadCity3();

                ZLDC.Topo.BLL.Estate.SystemParamBLL.LoadUsage(sUsage, true, "用途");
                ZLDC.Topo.BLL.Estate.SystemParamBLL.LoadParamType(sType, true, "类型");

                btnCompetences();   // 权限控制按钮
            }
        }

        // 权限控制按钮
        private void btnCompetences()
        {
            if (!ZLDC.Common.BaseUser.UserInfo.GetPopedom("添加楼盘字典"))
                HLAddEstate.Visible = false;
            if (!ZLDC.Common.BaseUser.UserInfo.GetPopedom("删除楼盘字典"))
            {
                btnDelete.Visible = false;
                btnOk.Visible = false;
                btnAllDel.Visible = false;
            }

            if (ZLDC.Common.BaseUser.UserInfo.GetPopedom("修改楼盘字典"))
                hCompetencesIsEdit.Value = "1";
            if (ZLDC.Common.BaseUser.UserInfo.GetPopedom("申请添加别名"))
                hCompetencesIsOtherName.Value = "1";

            if (ZLDC.Common.BaseUser.UserInfo.GetPopedom("审核楼盘字典"))
            {
                hCompetencesIsCheck.Value = "1";
                btnAllCheck.Visible = true;
            }
        }

        /// <summary>
        /// 加载城市
        /// </summary>
        private void LoadCity1()
        {
            ZLDC.Topo.BLL.Estate.AreaBLL.LoadCity(sCity1, 0);
        }

        /// <summary>
        /// 加载城区
        /// </summary>
        private void LoadCity2()
        {
            ZLDC.Topo.BLL.Estate.AreaBLL.LoadCity(sCity2, _Convert.ToInt(sCity1.Value, 0));
            ListItem item1 = new ListItem("全部", "0");
            sCity2.Items.Insert(0, item1);
        }

        /// <summary>
        /// 加载片区
        /// </summary>
        private void LoadCity3()
        {
            //ZLDC.Topo.BLL.Estate.AreaBLL.LoadCity(sCity3, _Convert.ToInt(sCity2.Value, 0));
            ListItem item1 = new ListItem("全部", "0");
            sCity3.Items.Insert(0, item1);
        }
    }
}
